package com.moana.buyTicket.util.email;
import com.moana.buyTicket.util.Config;


public class EmailSender {
	private static String username=Config.getEmail_username();
	private static String password=Config.getEmail_password();
	private static String host=Config.getEmail_host();
	private static String port=Config.getEmail_port();
	
	
	public  boolean send(String email,String subject,String content){
        //这个类主要是设置邮件
		try {
			username=Config.getEmail_username();
			password=Config.getEmail_password();
			host=Config.getEmail_host();
			port=Config.getEmail_port();
		    MailSenderInfo mailInfo = new MailSenderInfo(); 
		    mailInfo.setMailServerHost(host); 
		    mailInfo.setMailServerPort(port); 
		    mailInfo.setValidate(true); 
		    mailInfo.setUserName(username); 
		    mailInfo.setPassword(password);//您的邮箱密码 
		    mailInfo.setFromAddress(username); 
		    mailInfo.setToAddress(email); 
		    mailInfo.setSubject(subject); 
		    mailInfo.setContent(content); 
		    SimpleMailSender sms = new SimpleMailSender();
	        return sms.sendTextMail(mailInfo);//发送文体格式 
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
		return false;
	}
}
